package server.whiteboard;

import com.alibaba.fastjson.JSON;

public class WbResponse<T> {

    /**
     * 弹窗信息
     */
    public final static int MSG_CODE = 0;
    /**
     * 加载画板数据
     */
    public final static int LOAD_BOARD_CODE = 1;
    /**
     * 刷新成员列表
     */
    public final static int FLUSH_MEMBERS_CODE = 2;
    /**
     * 更新画板
     */
    public final static int UPDATE_BOARD_CODE = 3;
    /**
     * 聊天信息
     */
    public final static int CHAT_MESSAGE_CODE = 4;
    /**
     * 清空画板数据
     */
    public final static int CLEAR_BOARD_CODE = 5;

    public WbResponse(int code, T result) {
        this.code = code;
        this.result = result;
    }

    public String json() {
        return JSON.toJSONString(this);
    }

    private int code;
    private T result;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public T getResult() {
        return result;
    }

    public void setResult(T result) {
        this.result = result;
    }

}
